home *** CD-ROM | disk | FTP | other *** search
/ PC Shareware 1997 February / PC Shareware 1997-02.iso / programy / e! / api / mulhelp.pa_ / mulhelp.PAS
Encoding:
Pascal/Delphi Source File  |  1995-03-05  |  3.1 KB  |  105 lines

  1. {************************************************}
  2. {                         }
  3. { E! for Windows                 }
  4. { (c) - Patrick Philippot - 1992,1993         }
  5. {                         }
  6. { MulHelp Extension DLL - version 2.0         }
  7. {                         }
  8. { Supporting multiple Help Files from E!.     }
  9. {                         }
  10. {************************************************}
  11.  
  12. (*
  13. MULHELP is a simple EWD allowing use of multiple help files from within
  14. E!. There are many situations where you have to refer to multiple help
  15. files. For example, when writing Visual C++ source code with E!, you may
  16. want to refer to the Windows 3.1 SDK, the MFC 2.0 and the C/C++ language
  17. help files. It would be nice to load one of this file at will when the
  18. cursor is located on a keyword.
  19.  
  20. With MULHELP you can.
  21.  
  22. The first thing you have to do is to create a new section in EW.INI:
  23. [extended help]. Then, you will list in that section the help files
  24. you want to use, as follows:
  25.  
  26. HelpName1=file1.hlp
  27. HelpName2=file2.hlp
  28. HelpName3=file3.hlp
  29.  
  30. and so on...
  31.  
  32. Second, you should load MULHELP from the User menu (you can also install
  33. MULHELP as an autoloaded EWD). MULHELP.EWD must reside in your USER
  34. directory.
  35.  
  36. Third, open the Keyboard Assignment dialog box, select "Assign DLL" and
  37. MULHELP and assign MULHELP to, say, three different keystrokes, typing in
  38. each time a different Routine Id in the RoutineId field (1 for HelpName1, 2
  39. for HelpName2, ...).
  40.  
  41. You may use any unsigned integer as a Routine Id as long as it reflects the
  42. HelpName entry (e.g. HelpName20 will be used with Routine ID 20).
  43.  
  44. For example, I have setup MULHELP for my personal needs as follows:
  45.  
  46. [extended help]
  47. HelpName1=win31wh.hlp
  48. HelpName2=mfc.hlp
  49. HelpName3=mscxx.hlp
  50.  
  51. Key Assignments:
  52.  
  53. MULHELP assigned to SHIFT+F1    with Routine Id 1
  54. MULHELP assigned to ALT+F1    with Routine Id 2
  55. MULHELP assigned to ALT+CTRL+F1 with Routine Id 3
  56.  
  57. Now, when I hit SHIFT+F1 while the cursor is located on a keyword, I open
  58. the Windows 3.1 SDK help file (this was the standard behavior of E!). When
  59. I do the same with ALT+F1, I open the MFC help file with the same keyword.
  60. Ditto for ALT+CTRL+F1 with the C/C++ language help file.
  61.  
  62. Enjoy!
  63.  
  64. Patrick Philippot
  65. 07/08/93
  66. *)
  67.  
  68. {$I compdir.inc}
  69. {$C MOVEABLE PRELOAD DISCARDABLE}
  70.  
  71. library MulHelp;
  72.  
  73. uses WinProcs, WinTypes, EWApImp2, Strings;
  74.  
  75. const
  76.   HelpEntry   : PChar = 'HelpName';
  77.   HelpSection : PChar = 'Extended Help';
  78.   Profile     : PChar = 'ew.ini';
  79.  
  80. var
  81.   EntryValue   : array[0..80] of char;
  82.   HelpCurEntry : array[0..15] of char;
  83.  
  84. function EWExecute(RoutineId : word) : integer; export;
  85.  
  86. var
  87.   IDStr : array[0..5] of char;
  88.  
  89. begin
  90.   EWExecute := 0;
  91.   Str(RoutineId, IDStr);
  92.   StrCat(StrCopy(HelpCurEntry, HelpEntry), IDStr);
  93.   if GetPrivateProfileString(HelpSection, HelpCurEntry, '', EntryValue, SizeOf(EntryValue), Profile) <> 0 then begin
  94.     WritePrivateProfileString('system', 'alternatehelp', EntryValue, Profile);
  95.     EWAlternateHelp(EWGetCaretPosX, EWGetCaretPosY);
  96.   end else
  97.     EWMessageBox(GetFocus, 'No such Entry.', 'Extended Help', mb_Ok or mb_IconExclamation);
  98. end;
  99.  
  100. exports
  101.   EWExecute    index 1;
  102.  
  103. begin
  104. end.
  105.